From: Keir Fraser Date: Tue, 2 Oct 2007 09:45:53 +0000 (+0100) Subject: Clean up and fix XEN_SYSCTL_getcpuinfo error path. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14929^2~6 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=9972b2f0c4ec32d560914f7a467eba79dc632a30;p=xen.git Clean up and fix XEN_SYSCTL_getcpuinfo error path. Signed-off-by: Keir Fraser --- diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c index 39d0d8c31d..cde2ca8b36 100644 --- a/xen/common/sysctl.c +++ b/xen/common/sysctl.c @@ -177,18 +177,13 @@ long do_sysctl(XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl) if ( v->is_running ) cpuinfo.idletime += NOW() - v->runstate.state_entry_time; + ret = -EFAULT; if ( copy_to_guest_offset(op->u.getcpuinfo.info, i, &cpuinfo, 1) ) - { - ret = -EFAULT; - break; - } + goto out; } op->u.getcpuinfo.nr_cpus = i; - ret = 0; - - if ( copy_to_guest(u_sysctl, op, 1) ) - ret = -EFAULT; + ret = copy_to_guest(u_sysctl, op, 1) ? -EFAULT : 0; } break; @@ -209,6 +204,7 @@ long do_sysctl(XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl) break; } + out: spin_unlock(&sysctl_lock); return ret;